package downpacket

import "gitee.com/yanwc/ebike-xiaoan-device/internal/field"

type CommonUpgradeReq struct {
	Type    field.DeviceType `json:"type"`
	Url     string           `json:"url"`
	Crc     int              `json:"crc"`
	Version string           `json:"version"`
}

type HPKICKSTAND struct {
	Status  int    `json:"status"`
	Version string `json:"version"`
}

type DeviceInfoResp struct {
	HPKICKSTAND *HPKICKSTAND `json:"HPKICKSTAND"` // 宏溥脚撑模块
}

func NewCommonUpgradeReq(sn field.SerialNumber, req CommonUpgradeReq) *Req[CommonUpgradeReq] {
	return &Req[CommonUpgradeReq]{
		CmdWord: CommonUpgradeApiCommandWord,
		MsgNo:   sn,
		Param:   req,
	}
}

// 查询参数返回对象为 DeviceInfoResp
func NewQueryDeviceStateAndVersion(sn field.SerialNumber) *Req[any] {
	return &Req[any]{
		CmdWord: CommonUpgradeApiCommandWord,
		MsgNo:   sn,
		Param:   nil,
	}
}
